FROM alpine:3.8
LABEL maintainer=shuangsjye@163.com

# 定义环境变量
ENV LANG=C.UTF-8 \
    TZ=Asia/Shanghai

# 修改镜像源
RUN echo "" > /etc/apk/repositories \
    && echo "https://mirrors.aliyun.com/alpine/v3.8/main" >> /etc/apk/repositories \
    && echo "https://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories

# 安装软件
# apk 安装命令  apk add software1 software2 software3
# --no-cache 不使用本地缓存
# apk 命令 add-新增 update-根据远程镜像源更新本地镜像索引 upgrade-更新 del-卸载 search-查询 info-安装包信息
# ca-certificates证书服务，是安装glibc前置依赖
RUN apk update && apk add --no-cache openjdk8 ca-certificates tzdata ttf-dejavu tini \
    && rm -rf /var/cache/apk/*

# 修改系统时区和Java时区
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
    && echo $TZ > /etc/timezone

# 创建工作目录
RUN mkdir data \
    && mkdir data/java
WORKDIR /data/java

# 拷贝Jar
COPY mavendockerplugin.jar /data/java/

# Java日志输出
RUN echo "nohup java -jar mavendockerplugin.jar >> /data/java/info.log 2>&1 &" >> startJar.sh \
    && echo "tail -f -n 100 /data/java/info.log" >> startJar.sh

ENTRYPOINT source /data/java/startJar.sh
